package com.example.domain.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;

/**
 * 荔枝品种信息表，存储品种特性与文化内容
 * @TableName lychee_variety
 */
@TableName(value ="lychee_variety")
@Data
public class LycheeVariety implements Serializable {
    /**
     * 主键，自增ID
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 荔枝品种名称（如：妃子笑、白糖罂）
     */
    private String varietyName;

    /**
     * 品种特性描述（如果肉口感、成熟期等）
     */
    private String description;

    /**
     * 品种相关文化故事（如历史渊源、诗词引用等）
     */
    private String cultureStory;

    /**
     * 品种图片地址（云存储URL）
     */
    private String imageUrl;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        LycheeVariety other = (LycheeVariety) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getVarietyName() == null ? other.getVarietyName() == null : this.getVarietyName().equals(other.getVarietyName()))
            && (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()))
            && (this.getCultureStory() == null ? other.getCultureStory() == null : this.getCultureStory().equals(other.getCultureStory()))
            && (this.getImageUrl() == null ? other.getImageUrl() == null : this.getImageUrl().equals(other.getImageUrl()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getVarietyName() == null) ? 0 : getVarietyName().hashCode());
        result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
        result = prime * result + ((getCultureStory() == null) ? 0 : getCultureStory().hashCode());
        result = prime * result + ((getImageUrl() == null) ? 0 : getImageUrl().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", varietyName=").append(varietyName);
        sb.append(", description=").append(description);
        sb.append(", cultureStory=").append(cultureStory);
        sb.append(", imageUrl=").append(imageUrl);
        sb.append("]");
        return sb.toString();
    }
}